package offer;

public class Solution46 {
    public int translateNum(int num) {
        String s = String.valueOf(num);
        int n = s.length();
        int[] dp = new int[n + 1];
        dp[0] = 1;
        for (int i = 0; i < n; i++) {
            dp[i + 1] = dp[i];
            if (i > 0 && s.charAt(i - 1) != '0') {
                int t = (s.charAt(i - 1) - '0') * 10 + s.charAt(i) - '0';
                if (t < 26) {
                    dp[i + 1] += dp[i - 1];
                }
            }
        }
        return dp[n];
    }
}
